package com.zzzy.framework.common.annotation;


import com.zzzy.framework.validator.RangeValuesCheckValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * Description: 参数值范围 校验
 *
 * @author fc
 * @date 2024/4/11
 */
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = {RangeValuesCheckValidator.class})
public @interface RangeValuesCheck {

    //默认错误消息
    String message() default "必须为指定值";

    boolean allowBlank() default false;
    boolean allowNull() default false;

    String[] stringValueRange() default {};
    int[] intValueRange() default {};

    //使用指定枚举
    Class<?> enumValueRange() default Class.class;

    //分组
    Class<?>[] groups() default {};

    //负载
    Class<? extends Payload>[] payload() default {};
}
